import * as API from "./index";

//管理员登录
export const getLogin = (params) => {
  return API.POST("/api/v1/auth/manager_login", params);
};
// 获取管理员信息
export const getAdmin = (params) => {
  return API.GET("/api/v1/users/manager_info", params);
};


// 获取用户列表
export const getuserList = (params) => {
  return API.GET("/api/v1/admin/users", params);
};
// 新增用户
export const addUser = (params) => {
  return API.POST("/api/v1/admin/users", params);
};
// 修改用户
export const editUser = (params) => {
	API.PUT("/api/v1/admin/users/"+params.id,params);
};
// 删除用户信息
export const deleteUser = (params) => {
  return API.DELETE("/api/v1/admin/users/"+params.id);
};
//获取指定用户的信息
export const getUserInfo = (params) => {
  return API.GET("/api/v1/admin/users/"+params.id);
}
//修改用户密码
export const editUserPassword = (params) => {
  return API.PUT("/api/v1/admin/users/reset_pwd/"+params.id);
}
//获取用户收货地址
export const getUserAddress = (params) => {
  return API.GET("/api/v1/admin/addresses/:user_id", params);
};


//获取商品列表
export const getProduct = (params)=>{
	return API.GET('/api/v1/admin/products',params)
}
// 新增商品
export const postAddProduct = (params)=>{
	return API.POST('/api/v1/admin/products',params)
}
//修改商品信息
export const editProduct = (params) => {
	API.PUT("/api/v1/admin/products/"+params.id,params);
};
//删除商品信息
export const postDeleteProduct = (params)=>{
	return API.DELETE('/api/v1/admin/products/'+params.id)
}
//根据ID获取商品信息
export const getProductDetail = (params)=>{
	return API.GET('/api/v1/admin/products/'+params.id)
}


//获取商品分类列表
export const getProductCategories = (params)=>{
	return API.GET('/api/v1/admin/product_categories',params)
}
//新增商品分类信息
export const addProductCategoriesInfo = (params)=>{
	return API.POST('/api/v1/admin/product_categories',params)
}
//修改商品分类信息
export const editProductCategoriesInfo = (params)=>{
	API.PUT('/api/v1/admin/product_categories/'+params.id,params)
}
//删除商品分类信息
export const deleteProductCategoriesInfo = (params)=>{
	return API.DELETE('/api/v1/admin/product_categories/'+params.id)
}
//根据ID获取商品分类信息
export const getProductCategoriesInfo = (params)=>{
	return API.GET('/api/v1/admin/product_categories/'+params.id)
}


// 获取订单列表
export const getOrderList = (params)=>{
	return API.GET('/api/v1/admin/orders',params)
}
//修改订单信息
export const editOrder = (params)=>{
	API.PUT('/api/v1/admin/orders/'+params.id,params)
}
//删除订单信息
export const deleteOrder = (params)=>{
	return API.DELETE('/api/v1/admin/orders/'+params.id)
}
//根据ID获取订单信息
export const getOrderInfo = (params)=>{
	return API.GET('/api/v1/admin/orders/'+params.id)
}